extern crate grpcio;
extern crate protos;

use std::env;
use std::sync::Arc;

use grpcio::{ChannelBuilder, EnvBuilder};

use protos::example::diner::{Item, Order};
use protos::example::diner_grpc::DinerClient;
use std::env::args;

fn main() {
    let port = "8081".to_string();

    let env = Arc::new(EnvBuilder::new().build());
    let ch = ChannelBuilder::new(env).connect(format!("localhost:{}", port).as_str());
    let client = DinerClient::new(ch);

    let mut order = Order::new();
    order.set_items(vec![Item::SPAM, Item::EGGS]);
    let check = client.eat(&order).expect("RPC Failed!");
    println!("Ate {:?} and got charged ${:.2}", order, check.get_total());
}
